Keyboard shortcuts#134
Conversation
…es a user's individual shortcut preferences. ShortcutEditorDialog handles UI interactions and updates a KSM class instance accordingly. base_instrument.py was updated to implement these new classes and add a button to edit keyboard shortcuts.
…to Station or Log. alert column on right side indicates three states: ok (white), unsaved (orange), and duplicate (red). alert displays tooltip for each tooltip. ServerGui now holds a shortcut editor and shortcut manager, which is passed to an instrument tab when opened.
|
|
||
| from instrumentserver import QtCore, QtGui, QtWidgets | ||
|
|
||
| from .shortcuts import KeyboardShortcutManager |
There was a problem hiding this comment.
don't use . in the imports
|
|
||
| @staticmethod | ||
| def _matches_any_pattern(name: str, patterns: List[str]) -> bool: | ||
| def _matches_any_pattern(name: str, patterns: Optional[List[str]]) -> bool: |
There was a problem hiding this comment.
why add the Optional but not a None argument? is this really optional?
|
|
||
| # Indicates if a column is using delegates. | ||
| self.delegateColumns = delegateColumns | ||
| self.delegateColumns: List[int] = delegateColumns or [] |
There was a problem hiding this comment.
does changing the default change the behaviour downstream?
There was a problem hiding this comment.
the default set in the param list is None. the variable is used later in for loops, but if it is None, will this not raise an error? if it is empty, the loop will just exit immediately
| proxyModelType: type = InstrumentSortFilterProxyModel, | ||
| viewType: type = InstrumentTreeViewBase, | ||
| callSignals: bool = True, | ||
| shortcutManager: Optional[KeyboardShortcutManager] = None, |
There was a problem hiding this comment.
Add this argument to the docstring
| when Save is clicked. Use 'Save to file' / 'Load from file' to persist across sessions. | ||
|
|
||
| Each row has a small colored indicator dot in the rightmost column: | ||
| - white : saved and unique |
There was a problem hiding this comment.
I haven't been able to make it white even when saved
| kwargs["sub_port"] = kwargs.get("sub_port", self.stationServer.port + 1) # type: ignore[union-attr] | ||
| station_server = self.stationServer | ||
| if station_server is None: | ||
| raise RuntimeError("addInstrumentToGui called before server started") |
There was a problem hiding this comment.
what is this error and what is it catching?
There was a problem hiding this comment.
It was just a work around to the type ignore, but I now realize it was unnecessary because the server will always exist. Changed it back to the original.
| else QtCore.Qt.SortOrder.DescendingOrder | ||
| ) | ||
| header.setSortIndicator(col, new_order) | ||
|
|
There was a problem hiding this comment.
why do we need all these new slots?
There was a problem hiding this comment.
I removed the first three and refactored the code accordingly. As for the final four, they act as thin wrappers. They need to resolve what the currently selected item is to execute, something the right-click (for trash/star item) implicitly does
|
On top of the specific coding things 2 things are left on this:
|
…lso, removed 'Save' button, so only can save to file
Adds customizable keyboard shortcuts that a user can execute to streamline instrumentserver workflow